package com.alter.global.base;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.alter.model.SeUser;
import com.alter.system.service.SysbaseService;

/**
 * <pre>
 * User Controller <br>
 * session attribute : <br>
 * user -- current user
 * </pre>
 * 
 * @author A_Alter
 */
@Controller
@SessionAttributes({ "user" })
public class UserBaseAction {

    private Log logger = LogFactory.getLog("com.alter.global.base.UserBaseAction");

    @Autowired(required = true)
    private SysbaseService baseService;

    /**
     * 用户登录。
     * 
     * @param model
     * @return
     */
    @RequestMapping("/login")
    public String userLogin(Model model) {
	SeUser user = baseService.searchSeUserByName("A_Alter");
	model.addAttribute("user", user);
	// model.addAttribute("navList", sysuiservice.getSysNavBarList());
	logger.info("USER login");
	return "redirect:index";
    }

    /**
     * 系统首页
     * 
     * @param model
     * @return
     */
    @RequestMapping("/index")
    public String sysIndex(Model model) {
	// model.addAttribute("rightNavList",
	// sysuiservice.getRightNavList("1"));
	return "index";
    }

}
